<template>
  <el-input
    type="text"
    v-model="searchValue"
    :placeholder="
      config.placeholder
        ? config.placeholder
        : t('component.search.input_placeholder') + ' ' + config.label
    "
    :maxlength="config.maxlength ? config.maxlength : undefined"
    :readonly="config.readonly"
    :disabled="config.disabled"
    clearable
    @focus="config.onFocus"
    size="default"
  ></el-input>
</template>

<script setup>
import { computed } from "vue";
const props = defineProps(["model", "config"]);
const emit = defineEmits(["update"]);
import { useI18n } from "vue-i18n";
const { t } = useI18n();

const searchValue = computed({
  get() {
    return props.model;
  },
  set(value) {
    emit("update", props.config, value);
  },
});
</script>
